const {http ,handleStr} = require("../../utils/index")
Page({

    /**
     * 页面的初始数据
     */
    data: {
      movie:[]
    },

    onLoad: function (options) {
        
          var url = 'http://47.108.197.28:4000/api/movie/top250';
          http({
            url,
            success:result=>{
                this.handleHttpData(result) 
            }
        })
      },
      handleHttpData(result){
        var movie=[]
            var res = result.data.res;
            // console.log(res)
            res.forEach(item=>{
                var {pic,title} = item;
                movie.push({
                    pic,
                    title:handleStr(title)
                })
            })
            // console.log(movie)
            this.setData({
                movie
            })
          },
})